/* ========== 全局样式重置 ========== */
:root {
    --primary-color: #409EFF;
    --success-color: #67C23A;
    --warning-color: #E6A23C;
    --danger-color: #F56C6C;
    --info-color: #909399;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --border-color: #ebeef5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ========== 主容器 ========== */
.conversation_app {
    position: relative;
    min-height: 100vh;
    background-color: var(--bg-color);
    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', Arial, sans-serif;
    color: var(--text-color);
}

/* ========== 主内容区 ========== */
.conversation-main-content {
    width: 100%;
    padding: 20px;
    transition: all 0.3s ease;
}

.conversation-main-content.with-detail {
    filter: brightness(0.97);
    transform: scale(0.98);
    border-radius: 8px;
}

/* ========== 搜索区域 ========== */
.search-header {
    margin-bottom: 20px;
    background: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}

.search-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--info-color);
    z-index: 1;
}

.search-box .el-input__inner {
    padding-left: 36px !important;
    border-radius: 20px;
    height: 40px;
    line-height: 40px;
}

/* ========== 表格样式 ========== */
.conversation-table {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.el-table {
    --el-table-border-color: var(--border-color);
    --el-table-header-bg-color: #f5f7fa;
}

.el-table th {
    font-weight: 600;
    color: var(--text-color);
}

.el-table__row:hover td {
    background-color: rgba(64, 158, 255, 0.08) !important;
}

.el-table--striped .el-table__body tr.el-table__row--striped td {
    background-color: #fafbfc;
}

/* ========== 右侧浮层 ========== */
.chat-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 40%;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
}

.chat-detail-drawer.active {
    transform: translateX(0);
}

/* 浮层头部 */
.drawer-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    position: relative;
    z-index: 10;
}

.record-title {
    font-size: 18px;
    font-weight: 600;
}
.record-total{
    font-size: 14px;
}
.record-nav {
    display: flex;
    gap: 8px;
    margin: 16px 16px;
}

.record-nav .el-button {
    padding: 6px 10px;
    font-size: 12px;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.message-container {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
    gap: 10px;
}

.user-message-container {
    flex-direction: row-reverse;
}

.message-container > .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: solid 1px #eee;
}

.message-container > .avatar > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 4px;
    box-sizing: border-box;
}

.message-container > .message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.message-container .message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message-container .message-content {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    border-top-right-radius: 4px;
}

.assistant-message-container .message-content {
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    margin-right: auto;
    border-top-left-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: var(--info-color);
    margin-top: 4px;
    text-align: right;
}

.bot-message-container .message-time {
    text-align: left;
}

/* 图片消息 */
.image-meta {
    font-size: 12px;
    color: var(--info-color);
    margin-top: 6px;
}

/* 底部统计 */
.drawer-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

/* ========== 遮罩层 ========== */
.overlay-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /*backdrop-filter: blur(2px);*/
}

.overlay-mask.active {
    opacity: 1;
    pointer-events: auto;
}

/* ========== 按钮样式 ========== */
.el-button {
    transition: all 0.2s;
}

.delete-btn {
    color: var(--danger-color);
}

.delete-btn:hover {
    color: #f33;
}

/* ========== 分页样式 ========== */
.el-pagination {
    padding: 16px;
    text-align: right;
    background: #fff;
    border-top: 1px solid var(--border-color);
}

/* ========== 响应式设计 ========== */
@media (max-width: 992px) {
    .chat-detail-drawer {
        width: 420px;
    }

    .chat-detail-drawer.active {
        transform: translateX(-420px);
    }
}

@media (max-width: 768px) {
    .conversation-main-content.with-detail {
        transform: none;
        filter: brightness(0.95);
    }

    .chat-detail-drawer {
        width: 100vw;
        right: -100vw;
    }

    .chat-detail-drawer.active {
        transform: translateX(-100vw);
    }

    .search-filter {
        flex-direction: column;
    }

    .search-box,
    .el-select,
    .el-date-editor {
        width: 100% !important;
    }

    .record-nav {
        flex-wrap: wrap;
        justify-content: center;
        margin: 8px 0;
    }
}

/* ========== 动画增强 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: fadeIn 0.3s ease forwards;
}

.message:nth-child(odd) {
    animation-delay: 0.05s;
}

/* ========== 聊天消息中的链接样式 ========== */
/* 欢迎语链接特殊样式 - 简洁风格 */
.welcome-msg-link {
    color: #1890ff !important;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline;
    border-bottom: 1px dashed #1890ff;
    padding: 0 2px;
    position: relative;
}

.welcome-msg-link:hover {
    color: #40a9ff !important;
    text-decoration: none;
    border-bottom: 1px solid #40a9ff;
    background: rgba(24, 144, 255, 0.05);
}

.welcome-msg-link:active {
    color: #096dd9 !important;
}

/* 简洁的外部链接图标 */
.welcome-msg-link:after {
    content: "↗";
    font-size: 10px;
    color: #1890ff;
    margin-left: 2px;
    opacity: 0.7;
    vertical-align: super;
    transition: opacity 0.2s ease;
}

.welcome-msg-link:hover:after {
    opacity: 1;
    color: #40a9ff;
}

/* 普通聊天消息中的链接样式 - 更加自然融入对话 */
.chat-msg-link {
    color: #1890ff !important;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    display: inline;
    padding: 0 1px;
    border-radius: 2px;
}

.chat-msg-link:hover {
    color: #40a9ff !important;
    text-decoration: underline;
    text-decoration-style: solid;
    background: rgba(24, 144, 255, 0.08);
}

.chat-msg-link:active {
    color: #096dd9 !important;
}

/* 聊天消息链接的外部链接图标 - 更小更低调 */
.chat-msg-link:after {
    content: "↗";
    font-size: 9px;
    color: #1890ff;
    margin-left: 1px;
    opacity: 0.6;
    vertical-align: super;
    transition: opacity 0.2s ease;
}

.chat-msg-link:hover:after {
    opacity: 0.9;
    color: #40a9ff;
}

/* 在用户消息中的链接样式调整 */
.user-message-container .chat-msg-link {
    color: #ffffff !important;
    text-decoration-color: rgba(255, 255, 255, 0.8);
}

.user-message-container .chat-msg-link:hover {
    color: #ffffff !important;
    text-decoration-color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.15);
}

.user-message-container .chat-msg-link:after {
    color: #ffffff;
    opacity: 0.7;
}

.user-message-container .chat-msg-link:hover:after {
    opacity: 1;
    color: #ffffff;
}

/* 响应式处理 */
@media (max-width: 768px) {
    .welcome-msg-link {
        word-break: break-all;
    }
    
    .welcome-msg-link:after {
        font-size: 9px;
        margin-left: 1px;
    }
    
    .chat-msg-link {
        word-break: break-all;
    }
    
    .chat-msg-link:after {
        font-size: 8px;
        margin-left: 1px;
    }
}

/* ========== Markdown 元素样式 ========== */
.html-content h1, .html-content h2, .html-content h3, 
.html-content h4, .html-content h5, .html-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.25;
    border-bottom: none;
}

.html-content h1 { font-size: 1.5em; color: #2c3e50; }
.html-content h2 { font-size: 1.3em; color: #34495e; }
.html-content h3 { font-size: 1.15em; color: #34495e; }
.html-content h4 { font-size: 1.05em; color: #34495e; }
.html-content h5 { font-size: 1em; color: #34495e; }
.html-content h6 { font-size: 0.95em; color: #7f8c8d; }

/* 代码块样式 */
.html-content code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.html-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    line-height: 1.4;
}

.html-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #2c3e50;
    font-size: 0.9em;
}

/* 列表样式 */
.html-content ul, .html-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.html-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.html-content ul li {
    list-style-type: disc;
}

.html-content ol li {
    list-style-type: decimal;
}

/* 引用样式 */
.html-content blockquote {
    border-left: 4px solid #3498db;
    background-color: #f8f9fa;
    margin: 12px 0;
    padding: 8px 16px;
    color: #555;
    font-style: italic;
}

.html-content blockquote p {
    margin: 0;
}

/* 表格样式 */
.html-content table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.html-content table th,
.html-content table td {
    border: 1px solid #e9ecef;
    padding: 8px 12px;
    text-align: left;
}

.html-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.html-content table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.html-content table tr:hover {
    background-color: #e3f2fd;
}

/* 分隔线样式 */
.html-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #bdc3c7, transparent);
    margin: 20px 0;
}

/* 删除线样式 */
.html-content del {
    text-decoration: line-through;
    color: #7f8c8d;
    opacity: 0.8;
}

/* 图片样式 */
.html-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 强调样式 */
.html-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.html-content em {
    font-style: italic;
    color: #34495e;
}

/* 用户消息中的markdown样式调整 */
.user-message-container .html-content h1,
.user-message-container .html-content h2,
.user-message-container .html-content h3,
.user-message-container .html-content h4,
.user-message-container .html-content h5,
.user-message-container .html-content h6 {
    color: #ffffff;
}

.user-message-container .html-content code {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.user-message-container .html-content pre {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-message-container .html-content pre code {
    color: #ffffff;
}

.user-message-container .html-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.user-message-container .html-content strong {
    color: #ffffff;
}

.user-message-container .html-content em {
    color: rgba(255, 255, 255, 0.9);
}

.user-message-container .html-content table th {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.user-message-container .html-content table td {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* 响应式Markdown样式 */
@media (max-width: 768px) {
    .html-content table {
        font-size: 0.9em;
    }
    
    .html-content pre {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .html-content h1 { font-size: 1.3em; }
    .html-content h2 { font-size: 1.2em; }
    .html-content h3 { font-size: 1.1em; }
}